else if ( !strncmp(str, "off", 3) )
xc_mode = XC_OFF;
- switch (xc_mode)
+ switch ( xc_mode )
{
case XC_SERIAL:
- n = simple_strtol( str+4, &q, 10 );
- if ( q>str+4 ) xc_num = n;
- break;
-
+ n = simple_strtol( str+4, &q, 10 );
+ if ( q > (str + 4) ) xc_num = n;
+ break;
case XC_TTY:
- n = simple_strtol( str+3, &q, 10 );
- if ( q>str+3 ) xc_num = n;
- break;
+ n = simple_strtol( str+3, &q, 10 );
+ if ( q > (str + 3) ) xc_num = n;
+ break;
}
-printk("xc_num = %d\n",xc_num);
+
return 1;
}
__setup("xencons=", xencons_setup);
{
int rc;
- while ( count > 0 )
+ while ( (count > 0) &&
+ ((rc = HYPERVISOR_console_io(
+ CONSOLEIO_write, count, (char *)s)) > 0) )
{
- if ( (rc = HYPERVISOR_console_io(CONSOLEIO_write,
- count, (char *)s)) > 0 )
- {
- count -= rc;
- s += rc;
- }
- else
- break;
+ count -= rc;
+ s += rc;
}
}
xc_mode = XC_SERIAL;
kcons_info.write = kcons_write_dom0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- if ( xc_mode == XC_SERIAL )
- kcons_info.flags |= CON_ENABLED;
+ if ( xc_mode == XC_SERIAL )
+ kcons_info.flags |= CON_ENABLED;
#endif
}
else
{
case XC_SERIAL:
strcpy(kcons_info.name, "ttyS");
- if ( xc_num == -1 ) xc_num = 0;
- break;
+ if ( xc_num == -1 ) xc_num = 0;
+ break;
case XC_TTY:
strcpy(kcons_info.name, "tty");
- if ( xc_num == -1 ) xc_num = 1;
- break;
-
+ if ( xc_num == -1 ) xc_num = 1;
+ break;
+
default:
return __RETCODE;
}
* We use dangerous control-interface functions that require a quiescent
* system and no interrupts. Try to ensure this with a global cli().
*/
- local_irq_disable(); /* XXXsmp */
+ local_irq_disable(); /* XXXsmp */
/* Spin until console data is flushed through to the domain controller. */
while ( (wc != wp) && !ctrl_if_transmitter_empty() )
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static int xencons_write(struct tty_struct *tty, const unsigned char *buf,
- int count)
+static int xencons_write(
+ struct tty_struct *tty,
+ const unsigned char *buf,
+ int count)
{
int i;
unsigned long flags;
return i;
}
#else
-static int xencons_write(struct tty_struct *tty, int from_user,
- const u_char *buf, int count)
+static int xencons_write(
+ struct tty_struct *tty,
+ int from_user,
+ const u_char *buf,
+ int count)
{
int i;
unsigned long flags;
return 0;
}
-#define DUMMY (void *)xennullcon_dummy
+#define DUMMY (void *)xennullcon_dummy
/*
* The console `switch' structure for the dummy console
return 0;
}
-void physdev_modify_ioport_access_range( struct domain *d, int enable,
- int port, int num )
+void physdev_modify_ioport_access_range(
+ struct domain *d, int enable, int port, int num)
{
int i;
- ASSERT( d->arch.iobmp_mask );
- for ( i = port; i < port+num; i++ )
- {
- if(enable)
- clear_bit(i, d->arch.iobmp_mask);
- else
- set_bit(i, d->arch.iobmp_mask);
- }
+ for ( i = port; i < (port + num); i++ )
+ (enable ? clear_bit : set_bit)(i, d->arch.iobmp_mask);
}
/* Add a device to a per-domain device-access list. */
uart->lock = SPIN_LOCK_UNLOCKED;
}
-void serial_endboot()
+void serial_endboot(void)
{
int i;
-
- for (i=0;i<sizeof(com)/sizeof(struct uart);i++)
- {
- if( UART_ENABLED(&com[i]) )
- {
- /* remove access */
- physdev_modify_ioport_access_range( dom0, 0, com[i].io_base, 8 );
- }
- }
-
+ for ( i = 0; i < ARRAY_SIZE(com); i++ )
+ if ( UART_ENABLED(&com[i]) )
+ physdev_modify_ioport_access_range(dom0, 0, com[i].io_base, 8);
}
/*
#include <public/physdev.h>
-void physdev_modify_ioport_access_range( struct domain *d, int enable,
- int port, int num );
+void physdev_modify_ioport_access_range(
+ struct domain *d, int enable, int port, int num );
void physdev_destroy_state(struct domain *d);
-int physdev_pci_access_modify(domid_t dom, int bus, int dev, int func,
- int enable);
+int physdev_pci_access_modify(
+ domid_t dom, int bus, int dev, int func, int enable);
int domain_iomem_in_pfn(struct domain *p, unsigned long pfn);
long do_physdev_op(physdev_op_t *uop);
void physdev_init_dom0(struct domain *d);